package pms.Biz.impl;

import pms.Biz.RecordBiz;
import pms.dao.RecordDao;
import pms.dao.impl.RecordDaoImpl;
import pms.entity.*;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

public class RecordBizImpl implements RecordBiz {
    private RecordDao recordDao=new RecordDaoImpl();
    @Override
    public String getTime() {
        LocalDateTime time=LocalDateTime.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        String formattedDateTime = time.format(formatter);
        return formattedDateTime;
    }

    @Override
    public boolean addRecord(Record record) {
        return recordDao.addRecord(record);
    }

    @Override
    public List<Record> getAllRecord() {
        return recordDao.queryAllRecord();
    }

    @Override
    public boolean deleteRecord(List list) {
        return recordDao.deleteAllRecord(list);
    }
    @Override
    public List<Medicine> getAllMedicine() {
        return recordDao.queryAllMedicine();
    }

    @Override
    public List<Supplier> getAllSupplier() {
        return recordDao.queryAllSupplier();
    }

    @Override
    public List<Order> getAllOrder() {
        return recordDao.queryAllOrder();
    }

    @Override
    public List<Sale> getAllSale() {
        return recordDao.queryAllSale();
    }

    @Override
    public List<Customer> getAllCustomer() {
        return recordDao.queryAllCustomer();
    }
}
